{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a78e4b1f-1310-4623-b930-bbb92e79dd31",
   "metadata": {},
   "source": [
    "### Try this notebook in Google Colab, Binder or SageMaker!\n",
    "\n",
    "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/zarr/OME-NGFF-Brainstem-MRI.ipynb)\n",
    "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/HEAD?labpath=examples%2Fintegrations%2Fzarr%2FOME-NGFF-Brainstem-MRI.ipynb)\n",
    "[![Open In SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/zarr/OME-NGFF-Brainstem-MRI.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7098496c-ed91-42c9-886e-d4f4f7a9e7cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Install dependencies for this example\n",
    "import sys\n",
    "\n",
    "!{sys.executable} -m pip install -q zarr \"fsspec[http]\" \"itkwidgets[all]>=1.0a23\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2933a72d-ee4d-475c-9573-990d435c5788",
   "metadata": {},
   "outputs": [],
   "source": [
    "from zarr.storage import FSStore\n",
    "import zarr\n",
    "\n",
    "from itkwidgets import view"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9abd9d2f-8a7a-423c-a82d-50ba66a36fa0",
   "metadata": {},
   "outputs": [],
   "source": [
    "from zarr.storage import FSStore"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6cf3989-47f1-44e5-8349-6fabec35e6ec",
   "metadata": {},
   "source": [
    "Johnson, G Allan; Calabrese, Evan; Ghosh, Satrajit (2022) MRI of human ex vivo brainstem (Version draft) [Data set]. DANDI archive. https://dandiarchive.org/dandiset/000243/draft"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e6e357a4-3b8a-44d8-ae27-040ad725dabf",
   "metadata": {},
   "outputs": [],
   "source": [
    "fsstore = FSStore('https://dandiarchive.s3.amazonaws.com/zarr/7723d02f-1f71-4553-a7b0-47bda1ae8b42')\n",
    "brainstem = zarr.open_group(fsstore, mode='r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0967a339-519e-4d26-af3e-e88f2d1ec043",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "                <img id=\"screenshot_imjoy_window_3fe5dad8-c678-428b-bd40-47adf6b815ef\" src=>\n",
       "                <script type=\"text/javascript\">\n",
       "                    var image = document.getElementById(\"screenshot_imjoy_window_3fe5dad8-c678-428b-bd40-47adf6b815ef\");\n",
       "                    image.src = \"\";\n",
       "                    var viewer = document.getElementById(\"imjoy_window_3fe5dad8-c678-428b-bd40-47adf6b815ef\");\n",
       "                    // Hide the static image if the Viewer is visible\n",
       "                    image.style.display = viewer ? \"none\" : \"block\";\n",
       "                </script>\n",
       "            "
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "window.connectPlugin && window.connectPlugin(\"1b4ed782-2be0-4323-9bac-e192df9c52bb\")"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div id=\"1600f0fb-a6d0-4983-83db-ba436bd64416\"></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<itkwidgets.viewer.Viewer at 0x11450e560>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "view(brainstem)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
